package com.team7.home.controller;

import com.team7.common.vo.AddCourseVo;
import com.team7.common.vo.CommonResult;
import com.team7.common.vo.CourseVo;
import com.team7.home.service.ZoneCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: team7-object-master
 * @description:
 * @author: 王金涛
 * @create: 2021-10-21 10:53
 **/

@RestController
@RequestMapping("/home/zone-course")
public class ZoneCourseController {

    @Autowired
    private ZoneCourseService zoneCourseService;

    @PostMapping("getAllDetail/{page}/{limit}")
    public CommonResult getAllDetail(@PathVariable("page") Integer page,
                                     @PathVariable("limit") Integer limit,
                                     @RequestBody CourseVo courseVo){
        return zoneCourseService.getAllDetail(page, limit, courseVo);
    }

    @PostMapping("changeStatus/{id}/{isDisable}")
    public CommonResult changeStatus(@PathVariable("id") String id,@PathVariable("isDisable") Integer isDisable){
        return zoneCourseService.changeStatus(id,isDisable);
    }

    @PostMapping("deleteZoneCourse")
    public CommonResult deleteZone(@RequestBody CourseVo courseVo){
        return zoneCourseService.deleteZone(courseVo.getId());
    }

    @PostMapping("addCourseDetail")
    public CommonResult addCourseDetail(@RequestBody AddCourseVo addCourse){
        return zoneCourseService.addCourseDetail(addCourse);
    }

    @PostMapping("findCourse/{page}/{limit}")
    public CommonResult findCourse(@PathVariable("page") Integer page,
                                   @PathVariable("limit") Integer limit,
                                   @RequestBody CourseVo courseVoz){
        return zoneCourseService.get(page,limit,courseVoz);
    }
}